<?php
    require_once("../inc/functions.php");
	
	$user_results = getUsers();
	
?>
<!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title><?=$title ?> Create New Sales Order</title>
         <? require('../inc/header-info.php'); ?>
    </head>
    <body>
        <div class="container">
            <? include('../inc/nav.php'); ?>
             	<h4>Create New Sales Order</h4>
             	<h5>Select Existing Customer</h5>
   	  			<form class="form-inline"  name="existingUser" method="post" action="create-salesorders.php">
  					<div class="input-append">
  						<input type="hidden" name="existingUser" value='1'>
  			    		<input type="hidden" name="id" value=''>
    					<select name='user_id' class="span5">
    							
    					<? while($user_row = $user_results->fetch_assoc()): ?>
  							<option value='<?=$user_row['id'] ?>'> ID<?=$user_row['id'] ?> : <?=$user_row['last_name'] ?>, <?=$user_row['first_name'] ?> </option>
  						<? endwhile; ?>
  						
						</select>
    					<button type="submit" class="btn">Existing</button>
    					<a href="<?=$url?>users/create.php"><button class="btn" type="button">New Customer</button></a></a>
  					</div>
  				</form>
  				<?/*
  				<form class="form-inline"  name="newEmail" method="post" action="../email/email-edit.php">
  				<? if($email_row = $address->fetch_assoc()): ?>
    					<tr>
							<td><?=$email_row['address']?></td>
							<td><?=$email_row['Contact']?></td>
							<td>
								<a href="<?=$url?>email/email-update.php?id=<?=$row['id'] ?>&addressid=<?=$email_row['id']?>"><button class="btn btn-mini btn-primary" type="button">Edit</button></a>
                            	<a href="<?=$url?>email/email-edit.php?id=<?=$row['id'] ?>&addressid=<?=$email_row['id']?>"><button class="btn btn-mini btn-primary" type="button">Delete</button></a>
							</td>
                        </tr>
                <? endif; ?>
                    
                    </form>*/?>
  		</div>
  	</body>
</html>